<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="utf-8">
    <title>供应商注册</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form">
    <div class="layui-form-item">
        <label class="layui-form-label required">公司名称</label>
        <div class="layui-input-block">
            <input id="firm" type="text" name="firm" lay-verify="required" lay-reqtext="公司名称不能为空" placeholder="请输入公司名称" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" id="area-picker">
        <div class="layui-form-label">地址</div>
        <div class="layui-input-inline" style="width: 200px;">
            <select name="province" class="province-selector" data-value="河南省" lay-filter="province-1">
                <option value="">请选择省</option>
            </select>
        </div>
        <div class="layui-input-inline" style="width: 200px;">
            <select name="city" class="city-selector" data-value="新乡市" lay-filter="city-1">
                <option value="">请选择市</option>
            </select>
        </div>
        <div class="layui-input-inline" style="width: 200px;">
            <select name="county" class="county-selector" data-value="红旗区" lay-filter="county-1">
                <option value="">请选择区</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">负责人姓名</label>
        <div class="layui-input-block">
            <input id="sname" type="text" name="sname" lay-verify="required" lay-reqtext="负责人不能为空" placeholder="请输入姓名" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">联系方式</label>
        <div class="layui-input-block">
            <input id="phone" type="number" name="phone" lay-verify="required" lay-reqtext="手机号不能为空" placeholder="请输入手机号" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">主营业务</label>
        <div class="layui-input-block">
            <input id="scope" type="text" name="scope" lay-verify="required" lay-reqtext="主营业务不能为空" placeholder="请输入主营业务" value="" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>
</div>
<script src="${pageContext.request.contextPath}../../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath}../../lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
<script>
    //配置插件目录
    layui.config({
        base: '../../../../jsp/layuimini/js/lay-module/layarea/'
        , version: '1.0'
    });
    layui.use(['layer', 'form', 'layarea'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$,
            layarea = layui.layarea;

            layarea.render({
                elem: '#area-picker',
            });

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            var index=JSON.stringify(data.field)
            $.post(
                "/suppiler/add",{
                    suppilerlist:index
                },function (d) {
                    if (d=="true"){
                        var iframeIndex = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(iframeIndex);
                    }else {
                        layer.alert("远程连接出错~~~无法访问服务器")
                    }

                }
            )

            return false;
        });


    });
</script>
</body>
</html>